package com.yincheng.oes.business.exam.export.analysispaper.controller;

import com.yincheng.oes.business.exam.export.analysispaper.entity.AnalysisResult;
import com.yincheng.oes.business.exam.export.analysispaper.service.AnalysisPaperService;
import com.yincheng.oes.business.exam.export.model.ExportAnalysisParam;
import com.yincheng.oes.business.model.result.BusinessResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/export/analysisPaper")
public class AnalysisPaperController {
    @Autowired
    private AnalysisPaperService analysisPaperService;

    @RequestMapping(value = "/getAnalysisPaperResult.json", method = RequestMethod.GET)
    @ResponseBody
    public List<AnalysisResult> exportAnalysisPaper(ExportAnalysisParam param) {
        List<AnalysisResult> analysisPaperResult = analysisPaperService.getAnalysisPaperResult(param);
        return analysisPaperResult;
    }

    @RequestMapping(value = "/downloadAnalysisPapers.json", method = RequestMethod.POST)
    @ResponseBody
    public BusinessResult downloadAnalysisPapers(@RequestBody ExportAnalysisParam param)  {
        return analysisPaperService.exportZipStudentAnalysisPapers(param);
    }
}
